package com.melorour.product.utils;

import com.melorour.product.enums.CodeEnum;

/**
 * @author Melorour on 2018/4/13.
 */

public class EnumUtil {
    public static <T extends CodeEnum> T getByCode(Integer code,Class<T> enamClass) {
        for (T each : enamClass.getEnumConstants()) {
            if (code.equals(each.getCode())) {
                return each;
            }
        }
        return null;
    }
}
